<?php
include('common.php');


$adminmenu[0] = array(
    'headnav' => '财务管理',
    'subnav' => array(
        array('name' => '销售统计', 'menumark' => 'sale_sta', 'url' => 'admin.php?mod=sale_sta'),
    )
);
$adminmenu[4] = array(
	'headnav' => '订单管理',
	'subnav' => array(
		array('name' => '订单列表', 'menumark' => 'order', 'url' => 'admin.php?mod=order'),
//		array('name' => '住房管理', 'menumark' => 'zhufang', 'url' => 'admin.php?mod=zhufang')
	)
);
$adminmenu[2] = array(
	'headnav' => '价格管理',
	'subnav' => array(
		array('name' => '价格列表', 'menumark' => 'house', 'url' => 'admin.php?mod=price'),

	)
);
$adminmenu[1] = array(
	'headnav' => '商品管理',
	'subnav' => array(
		array('name' => '商品列表', 'menumark' => 'commodity', 'url' => 'admin.php?mod=commodity'),
	)
);

$adminmenu[3] = array(
    'headnav' => '轮播管理',
    'subnav' => array(
        array('name' => '图片列表', 'menumark' => 'ad', 'url' => 'admin.php?mod=ad'),
    )
);
$adminmenu[5] = array(
    'headnav' => '账户管理',
    'subnav' => array(
        array('name' => '用户列表', 'menumark' => 'user', 'url' => 'admin.php?mod=user'),

    )
);
$adminmenu[6] = array(
	'headnav' => '基础设置',
	'subnav' => array(
		array('name' => '系统设置', 'menumark' => 'setting', 'url' => 'admin.php?mod=setting'),

	)
);
if (!pe_login('admin') && !($mod == 'do' && $act == 'login')) {
	pe_goto('admin.php?mod=do&act=login');
}
if (pe_login('admin') && ($mod == 'do' && $act == 'login')) {
	pe_goto('admin.php');
}

$admin = $db->pe_select('admin', array('admin_id'=>$_s_admin_id));
$cache_adminlevel = cache::get('adminlevel');
if (!in_array($mod, array('index', 'do')) && $admin['adminlevel_id'] != 1) {
	$admin_result = false;
	$adminlevel_modact = unserialize($cache_adminlevel[$admin['adminlevel_id']]['adminlevel_modact']);
	$adminlevel_modact = $adminlevel_modact ? $adminlevel_modact : array();
	foreach ($adminlevel_modact as $v) {
		foreach(explode('|', $v) as $vv) {
			if ("{$mod}-{$act}" == $vv or $mod == $vv) $admin_result = true;
		}
	}
	!$admin_result && pe_error('权限不足...');
}

if (in_array("{$mod}.php", pe_dirlist("{$pe['path_root']}module/{$module}/*.php"))) {
	include("{$pe['path_root']}module/{$module}/{$mod}.php");
}
pe_result();
?>